// @ts-ignore
/* eslint-disable */
import request from '@/request'

/** getCommentsByTarget GET /api/comments */
export async function getCommentsByTargetUsingGet(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getCommentsByTargetUsingGETParams,
  options?: { [key: string]: any }
) {
  return request<API.PageCommentDTO_>('/api/comments', {
    method: 'GET',
    params: {
      // pageNum has a default value: 1
      pageNum: '1',
      // pageSize has a default value: 10
      pageSize: '10',

      ...params,
    },
    ...(options || {}),
  })
}

/** publishComment POST /api/comments */
export async function publishCommentUsingPost(
  body: API.CommentRequest,
  options?: { [key: string]: any }
) {
  return request<API.CommentDTO>('/api/comments', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** likeComment POST /api/comments/${param0}/likes */
export async function likeCommentUsingPost(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.likeCommentUsingPOSTParams,
  options?: { [key: string]: any }
) {
  const { commentId: param0, ...queryParams } = params
  return request<boolean>(`/api/comments/${param0}/likes`, {
    method: 'POST',
    params: {
      ...queryParams,
    },
    ...(options || {}),
  })
}

/** cancelLikeComment DELETE /api/comments/${param0}/likes */
export async function cancelLikeCommentUsingDelete(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.cancelLikeCommentUsingDELETEParams,
  options?: { [key: string]: any }
) {
  const { commentId: param0, ...queryParams } = params
  return request<boolean>(`/api/comments/${param0}/likes`, {
    method: 'DELETE',
    params: {
      ...queryParams,
    },
    ...(options || {}),
  })
}

/** getRepliesByCommentId GET /api/comments/${param0}/replies */
export async function getRepliesByCommentIdUsingGet(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getRepliesByCommentIdUsingGETParams,
  options?: { [key: string]: any }
) {
  const { commentId: param0, ...queryParams } = params
  return request<API.CommentDTO[]>(`/api/comments/${param0}/replies`, {
    method: 'GET',
    params: {
      ...queryParams,
    },
    ...(options || {}),
  })
}
